Python uses the pie function of matplotlib to draw a pie chart. matplotlibpie
This article describes how to use matplotlib's pie function to draw a pie chart in
This evening I learned how to use the pycha module to create various office charts. This is very simple. In this article, I have used seven charts.
This module and the API address are: Release.
I. Code:
#! /Usr/bin/ENV Python #-*-coding: UTF-8-*-import Cairo import pycha. pieimport pycha. barimport pycha. scatterimport pycha. stackedbarimport pycha. line # Set the canvas def set_charvalue (): width, height = 600,600 surface = Cairo. imagesurface (Ca
Python uses the matplotlib library to draw a pie chart.
Introduction
Matplotlib is the most famous Drawing Library in python. It provides a complete set of command APIs similar to matlab and is very suitable for interactive plotting. It can also be easily used as a drawing control and embedded into GUI applications.
It
Introduced
Matplotlib is Python's most famous drawing library, which provides a complete set of command APIs similar to MATLAB and is ideal for interactive charting. It can also be conveniently embedded in GUI applications as a drawing control.
Its documentation is fairly complete, and there are hundreds of thumbnails on the Gallery page, which are available after they are opened. So if you need to draw some kind of diagram, just browse/copy/paste it in this page, and basically you can do it.
AChartEngine and JFreeChart use open chart production class libraries written in Java. The former is applied on android, and the latter can also be mainly applied on java se or java ee. AChartEngine is an open-source project developed by Google.
2. Implement PieChart using AChartEngine
The pie chart is encapsulated here. You only need to prepare the data to impl
Pie chart
Copy Code code as follows:
//+------------------------+
//| Pie3dfun. php//Common Functions |
//+------------------------+
Define ("Angle_step", 3); Defines the angle step when drawing an elliptical arc
Define ("font_used", "C:\WINDOWS\Fonts\simhei.ttf"); The font file location to use
function Draw_getdarkcolor ($img, $CLR)//$CLR the corresponding dark color
{
$rgb = Imagecolor
content.Markpoint:Plot points, including the maximum small value, and the inflection pointMarkline:Draw a line, mean lineSplitline:falseSplit LineGrid: Setting up gridsGrid: {borderwidth:0,/* border=0 on both sides */x: ' 55px ',/* Change the size of the line chart by modifying the xy x2 y2 */Y: ' 25px ',X2: ' 20px ',Y2: ' 20px ',},Trigger:item/axis/* Triggers the style displayed by the Cue box */ToolTip: {Trigger: ' Item '},ItemStyle:/* To set the i
(compliant, values [2]); series. add (excellent, values [3]); return series ;}
How to Set dataset-bar chart can have multiple groups of data
1 String[] titles={test};2 List
values=new ArrayList
();3 values.add(new double[]{5120.0,21251.0,25610.0});4 XYMultipleSeriesDataset dataset=buildBarDataset(titles, values);
protected XYMultipleSeriesDataset buildBarDataset(String[] titles, List
values) {
First look at the effect:First, create a pie chart objectTo create a pie chart object using the class is PieChartView.h, the code is as follows:
Self.piechartview = [[Piechartview alloc] init];
Self.pieChartView.backgroundColor = BgColor;
[Self.view AddSubview:self.pieChartView];
[Self.piechartview
First:
Pie chart:
Bar chart:
Find information on the Internet, sort it out, and comment out the configurationCodeAs follows:
1. All the code for creating a pie chart
///
/// Obtain the slice chart based on
piecolor objectEach product on the pie chart needs to be displayed in a different color. To facilitate this, I have created a piecolor object (Listing d), Which contains an arrayColorObjects:Color piecolorarray [] = {new color (60,210, 60, 60), new color (, 60 )...}
The piecolor class defines a setnewcolor () method, which increments curpiecolor,The index used to access the piecolorarray [].The method als
Write a pie chart to customize the view article today. Since the company's project needs a pie chart, the UI gives the design and the title of the pie frame you're looking for does not match, so you draw one yourself.1, using previewPiechart Mchart Mchart = (piechart) Findvi
The company recently in the statistical function, so used to the pie chart, on-line search some information finally decided to use Mpandroidchart, very convenient to use, there are some problems through a variety of search, finally solved ... Don't say much nonsense, first look at:
Layout file:
[Java]View Plain
Copy
Highcharts translation series 13: pie Chart and other graphic Pie chart parameter description default value allowPointSelect when you click the label, the sequence points are allowed to be selected falseanimation animation trueborderColor border color # FFFFFFborderWidth Border Width 1.0center
Using Tkinter and matplotlib to draw a pie chart, tkintermatplotlib
When learning python, we will always use some common modules. Next I will explain in detail how to use two different methods to draw a pie chart.First, use the canvas in [Tkinter] to draw a pie
production libraries written in Java, which are used on Android, which can also be used primarily on Java SE or Java EE. Achartengine is an open source project developed by Google.2, Achartengine realize PiechartThis is a pie chart package, only need to prepare the data to achieve the corresponding functionPackage Com.example.chartdemo;Import Java.text.NumberFormat;Import Java.util.Map;Import Java.util.Ran
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.